3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
Figure 17 shows a cylinder.
Vector3D orientation
Vector3D majorRadius
Vector3D minorRadius
Point3D origin
Float32 uMin
Float32 uMax
Float32 vMin
Float32 vMax
A cylinder is a three-dimensional object defined by an origin (that is, the center of the cylinder) and three mutually perpendicular vectors that define the orientation and the major and minor radii of the cylinder. A cylinder may include a top cap, a bottom cap, or both. Attributes may be assigned to each included cap, to the face of the cylinder, and to the entire cylinder.
The default surface parameterization for a cylinder is as shown in Figure 17 .
Caps (top), top cap attribute set, caps (bottom), bottom cap attribute set, face cap attribute set, attribute set. All child objects are optional.
Cylinder ( )
Cylinder (
0 2 0
0 1 0
0 0 1
0 0 0
0 # uMin
1 # uMax
0 # vMin
1 # vMax
)
Container (
Cylinder ( )
Caps ( Bottom | Top )
Container (
BottomCapAttributeSet ( )
Container (
AttributeSet ( )
DiffuseColor ( 0 1 0 )
)
)
Container (
FaceCapAttributeSet ( )
Container (
AttributeSet ( )
DiffuseColor ( 1 0 1 )
)
)
Container (
TopCapAttributeSet ( )
Container (
AttributeSet ( )
DiffuseColor ( 1 1 0 )
)
)
)
In the above example, color attributes are attached to the surface of the cylinder very indirectly. As you see, color objects are elements of ordinary attribute sets rather than of cap attribute sets. Those attribute sets are elements of containers, which, in turn, are elements of cap attribute sets. The cap attribute sets serve to bind the ordinary attribute sets to the caps of the cylinder.
Previous | QD3D Book | Overview | Chapter Contents | Next |